import { Map } from 'immutable';

import {
    CHANGE_HOT_ALBUMS,
    CHANGE_TOP_ALBUMS,
    CHANGE_TOP_TOTAL,
} from './constants';

const defaultState = Map({
    hotAlbums: [],//热门新碟数据
    topAlbums: [],//全部新碟数据
    topTotal: 0,//全部新碟数据的总条数
})

export default function reducer(state = defaultState, action) {
    switch (action.type) {

        case CHANGE_HOT_ALBUMS:
            return state.set("hotAlbums", action.hotAlbums);

        case CHANGE_TOP_ALBUMS:
            return state.set("topAlbums", action.topAlbums);

        case CHANGE_TOP_TOTAL:
            return state.set("topTotal", action.total);

        default:
            return state;
    }
}
